﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Castle.ActiveRecord;
using System.ComponentModel.DataAnnotations;

namespace ZDSoft.LMS.Domain
{
    [ActiveRecord("TranportOrderItem")]
    public class TransportOrderItem : EntityBase
    {
        /// <summary>
        /// 货物品名
        /// </summary>
        [Property(NotNull = true, Length = 20)]
        [Display(Name = "货物品名")]
        [Required(ErrorMessage = "不能为空！")]
        [StringLength(20, ErrorMessage = "不能超过20个字符!")]
        public virtual string CargoName { get; set; }

        /// <summary>
        /// 集装箱箱型
        /// </summary>
        [Property(NotNull = true, Length = 20)]
        [Display(Name = "集装箱箱型")]
        [StringLength(20, ErrorMessage = "不能超过20个字符!")]
        public virtual string CabinetSort { get; set; }

        /// <summary>
        /// 集装箱箱类
        /// </summary>
        [Property(NotNull = true, Length = 20)]
        [Display(Name = "集装箱箱类")]
        [StringLength(20, ErrorMessage = "不能超过20个字符!")]
        public virtual string CabinetType { get; set; }

        /// <summary>
        /// 集装箱数量
        /// </summary>
        [Property(NotNull = true)]
        [Display(Name = "集装箱数量")]
        [Range(0, 50, ErrorMessage = "只能在0~50!")]
        public virtual int Counter { get; set; }

        /// <summary>
        /// 集装箱号码
        /// </summary>
        [Property(NotNull = true, Length = 20)]
        [Display(Name = "集装箱号码")]
        [Required(ErrorMessage = "不能为空！")]
        [StringLength(20, ErrorMessage = "不能超过20个字符!")]
        public virtual string CabinetNumber { get; set; }

        /// <summary>
        /// 施封号码
        /// </summary>
        [Property(NotNull = true, Length = 20)]
        [Display(Name = "施封号码")]
        [StringLength(20, ErrorMessage = "不能超过20个字符!")]
        public virtual string SealedNumber { get; set; }

        /// <summary>
        /// 运输费用
        /// </summary>
        [Property(NotNull = true, Length = 30)]
        [Display(Name = "运输费用")]
        public virtual decimal TransportFee { get; set; }

        /// <summary>
        /// 集装箱运输单
        /// </summary>
        [BelongsTo("TranportOrderID",Lazy=FetchWhen.OnInvoke)]
        public virtual TransportOrder TransportOrder { get; set; }
    }
}
